<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     <link href="plug-in/umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet"> 
    <script type="text/javascript" src="plug-in/umeditor/third-party/jquery.min.js"></script> 
    <script type="text/javascript" charset="utf-8" src="plug-in/umeditor/umeditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="plug-in/umeditor/umeditor.min.js"></script>
    <script type="text/javascript" src="plug-in/umeditor/lang/zh-cn/zh-cn.js"></script>
	<script type="text/javascript" src="plug-in/lhgDialog/lhgdialog.min.js?skin=metrole"></script> 
    <script type="text/javascript" src="js/common.js"></script>
	<link rel="stylesheet" href="css/index.css">
	<link rel="stylesheet" href="css/style_1_common.css">
	<link rel="stylesheet" href="css/umeditor_css.css"> 
    <link href="plug-in/jquery-ui/js/jquery-ui.min.css?v=1" type="text/css" rel="stylesheet">  
    <script type="text/javascript"src="plug-in/jquery-ui/js/jquery-ui.min.js?v=2"></script>
<title>群组文章</title>
</head>
<!--头部 -->
	<%@include file="head.jsp"%> 
    <div id="alertMessage"></div>
<div style="width: 100%; height: auto; background: #f8f8f8; padding-bottom: 10px;">

	<div style="width: 960px; margin: 0 auto; color: #666; padding-top: 10px; padding-bottom: 10px">
		<img style="vertical-align: sub" src="imges/fangzi.png"> > <span> <a href="<%=request.getContextPath() + "/indexController.do?group"%>">群组</a>>
			<a href="groupController.do?groupList&gid=${groupLink.group_parent_id }">${groupLink.group_parent_name }</a>> 
			<a href="groupController.do?groupList&gid=${groupLink.group_son_id }">${groupLink.group_son_name }</a>> 
			<a href="groupController.do?groupDetail&sid=${groupLink.id }">${groupLink.group_name }</a>>
			${article.title}
		</span>
	</div>
	<div id="pgt" class="cl">
		<div class="pgt">
			<div class="pgt_img">
				<img src="imges/fatie.jpg">
			</div>
			<div class="pg">
				<%
					int pageNo = 0, bfNo = 0;
					String pageNoStr = request.getParameter("page");
					String ard=request.getParameter("ard");
					if (StringUtil.isEmpty(pageNoStr) || "1".equals(pageNoStr)) {
						pageNo = 1;
						bfNo = 1;
					} else {
						pageNo = Integer.parseInt(pageNoStr);
						bfNo = pageNo - 1;
					}
					String annCount = request.getAttribute("pageCount").toString();
					int P_pageCount = Integer.parseInt(annCount);
				%>  
				<span class="pgb"><a href="groupController.do?thread&ard=<%=ard%>&page=<%=bfNo%>">返回</a></span>
				<%
					int showPages = 10;//显示10页
					if (showPages >= P_pageCount) {
						for (int i = 0; i < P_pageCount; i++) {
				%>
							<a class="<%=pageNo == (i + 1) ? "current" : ""%>" href="groupController.do?thread&ard=<%=ard%>&page=<%=(i + 1)%>"><%=(i + 1)%></a>
				<%
						} 
					} else {
						int pindex = 0;
						if (pageNo > (showPages / 2))
							pindex = pageNo - (showPages / 2);
						if ((pageNo > P_pageCount - (showPages / 2)) && (pageNo <= P_pageCount))
							pindex = P_pageCount - showPages;
						for (int i = pindex; i < showPages + pindex; i++) {
				%>
						<a class="<%=pageNo == (i + 1) ? "current" : ""%>" href="groupController.do?thread&ard=<%=ard%>&page=<%=(i + 1)%>"><%=(i + 1)%></a>
				<%}%>
					<a href="groupController.do?thread&ard=<%=ard%>&page=<%=P_pageCount %>" class="last">... <%=P_pageCount %></a> 
				<%}%> 
				<label>
					<input type="text" name="custompage" class="px" size="2" title="输入页码，按回车快速跳转" value="1">
					<span title="共 <%=P_pageCount %>页"> / <%=P_pageCount %>页</span>
				</label> 
				<a href="groupController.do?thread&ard=<%=ard %>&page=<%=(pageNo + 1)%>" class="nxt">下一页</a> 
			</div>
		</div>
	</div>
	<div class="yxyj">
		<div class="yxyj_l_t">
			<div class="yxyj_l_t_left">
				<div style="float: left; margin-top: 17px; margin-left: 30px;">
					<span>查看：</span><span style="color: #ff6600">${article.viewAccount}</span>
				</div>
				<div style="width: 1px; height: 30px; background: #f1f1f1; margin: auto; margin-top: 10px"></div>
				<div style="float: right; margin-right: 30px; margin-top: -23px;">
					<span>回复：</span><span style="color: #ff6600">${article.replyAccount}</span>
				</div>
			</div>
			<div class="yxyj_l_t_right">
				<div style="float: left; margin-left: 15px; margin-top: 18px">
					<span style="font-weight: bold; color: #000; font-size: 16px" id="span_article_title">【${article.title}】</span> <span style="font-size: 16px">[复制链接]</span>
				</div>
				<div style="float: right; margin-right: 15px; margin-top: 15px;">
					<img src="imges/zuoyou.jpg">
				</div>
			</div>
		</div>  
		<input type="hidden" id="group_sid" name="group_sid" value="${groupLink.group_son_id }">
		<input type="hidden" id="group_id" name="group_id" value="${groupLink.group_id }">
		<input type="hidden" id="art_id" name="art_id" value="${article.id }">
		<c:forEach items="${articles}" var="item" varStatus="status">
			<div class="yxyj_l_content">
			   <table class="plhin" cellspacing="0" cellpadding="0">
			    <tbody>
			    <tr>
			     <td class="pls" rowspan="2">
			        <div class="pi"><a href="" class="xw1">会员昵称</a><img src="imges/v1.jpg" style=" vertical-align:middle"></div>
			        <div class="avatar"><a href="" class="avtm"><img src="imges/touxiang.png"></a></div>
			          <div class="tns xg2">
			           <table cellspacing="0" cellpadding="0" width="100%">
			             <tbody>
			               <tr>
			                <th><p><a href="" class="xi3">10</a></p>主题</th>
			                <th><p><a href="" class="xi3">20</a></p>帖子</th>
			                <td><p><a href="" class="xi3">30</a></p>积分</td>
			               </tr>
			             </tbody>
			           </table>
			          </div>
			        <p><em><a href="">功勋管理员</a></em></p>
			        <p>
			          <span>
			           <img src="imges/star_level3.gif"><img src="imges/star_level3.gif"><img src="imges/star_level3.gif">
			           <img src="imges/star_level3.gif"><img src="imges/star_level2.gif"><img src="imges/star_level1.gif">
			          </span>
			        </p>
			        <p><span class="pbg2"><span class="pbr2" style="width:16%;"></span></span></p>
			        <dl class="pil cl">
			        	<dt>积分</dt><dd>30</dd>
			        	<dt>威望</dt><dd>11 点</dd>
			        	<dt>魅力</dt><dd>22 点</dd>
			        	<dt>贡献</dt><dd>33 点</dd>
			            <dt>易币</dt><dd>44 元</dd>
			            <dt><img style="vertical-align:middle" src="imges/jindou.gif"> 金豆</dt><dd>55 枚</dd>
			            <dt><img style="vertical-align:middle" src="imges/money.gif"> 现金</dt><dd>66 元</dd>  
			        </dl>
			        <p class="md_ctrl">
			          <a href=""><img src="imges/medal2.gif"><img src="imges/medal3.gif"><img src="imges/medal9.gif">
			          <img src="imges/medal11.gif"><img src="imges/medal12.gif"><img src="imges/boy.gif"><br>
			          <img src="imges/jxry.gif"></a>
			        </p>
			       <ul class="xl xl2 o cl" style="margin-left: -20px;"><li class="pm2"><a href="#">发消息</a></li></ul>
			     </td>
			     <td class="plc">
			        <div class="pi">
			          <strong>楼层</strong>
			         <div class="pti">
			           <div class="pdbt"></div>
			           <div style="float:left">
			             <img src="imges/ico_lz.png" class="authicn vm"><span id="span_article_username_id">会员昵称</span><span class="pipe">|</span><em>发表于<span id="span_article_createdate_id">发表时间</span></em>
			             <span class="pipe">|</span><a href="">只看该作者</a>
			           </div>
			         </div>
			       </div>
			       <div class="pct">
			         <div class="a_pt"><a href=""><font color="#FF0000">[普劝称赞圣号]</font><font color="#FF6600"><b>南无宝月智严光!</b></font></a></div>
			        <div class="pcb">
			         <div class="t_fsz">
			           <table cellspacing="0" cellpadding="0" width="100%">
			             <tbody>
			              <tr>
			               <td class="t_f">
			                 <div class="a_pr"><a href=""><img src="imges/200928gvhzhgnmzfagf0zo.jpg" height="600" width="160" border="0"></a></div>
			                 <div id="div_article_content_id">
				                 	文章内容
			                 </div>
			               </td>
			              </tr>
			             </tbody>
			            </table>
			          </div>
			        </div>
			      </div>
			    </td>
			    </tr> 
			    <tr>
			      <td class="plc plm"> 
			      <div class="sign" style="max-height:100px;maxHeightIE:100px;">
			        <font color="Red"><strong>职业...算命...风水...起名...择日...解灾.............QQ：1532312074</strong></font>
			      </div> 
			      <div class="a_pb">
			       <a href=""><font color="#FF0000">[普劝称赞圣号]</font><font color="#FF6600"><b>南无极乐世界阿弥陀佛！</b></font></a>
			      </div>
			      </td>
			    </tr>
			   <tr> </tr>
			   <tr>
			     <td class="pls"></td>
			      <td class="plc" style="overflow:visible;">
			       <div class="po hin">
			        <div class="pob cl">
			         <em><a class="fastre" href="javascript:replayWin('id')">回复</a>
			         	<a class="replyadd(1,'id')">支持</a>
			         	<a class="replyadd(0,'id)">反对</a>
			         </em>
			         <span><select class="showmenu"><option>使用道具</option><option>使用道具1</option><option>使用道具2</option></select>
			         	<a href="javascript:replayPfWin('id')">评分</a>
			         	<a href="">举报</a>
			         </span>
			        </div>
			       </div>
			     </td>
			   </tr>
			  </tbody>
			</table>
			</div>
		</c:forEach>
		<div id="postlistreply" class="pl">
				<div id="post_new" class="viewthread_table" style="display: none"></div>
		</div>
		<div style="clear: both"></div> 
	</div>
	<!-- 》》》》》》》》》》》》》》》》》》》 分  页 《《《《《《《《《《《《《《《《《《《《《《《《《  -->
	<div id="pgt" class="pgs mbm cl " style="margin-top: 5px;">
		<div class="pgt" >
			<div class="pgt_img">
				<a href="#" style="border: none">
					<img src="imges/fatie.jpg">
				</a>
			</div>
			<div class="pg"> 
				<span class="pgb"><a href="groupController.do?thread&ard=<%=ard%>&page=<%=bfNo%>">返回</a></span>
				<% 
					if (showPages >= P_pageCount) {
						for (int i = 0; i < P_pageCount; i++) {
				%>
							<a class="<%=pageNo == (i + 1) ? "current" : ""%>" href="groupController.do?thread&ard=<%=ard%>&page=<%=(i + 1)%>"><%=(i + 1)%></a>
				<%
						} 
					} else {
						int pindex = 0;
						if (pageNo > (showPages / 2))
							pindex = pageNo - (showPages / 2);
						if ((pageNo > P_pageCount - (showPages / 2)) && (pageNo <= P_pageCount))
							pindex = P_pageCount - showPages;
						for (int i = pindex; i < showPages + pindex; i++) {
				%>
						<a class="<%=pageNo == (i + 1) ? "current" : ""%>" href="groupController.do?thread&ard=<%=ard%>&page=<%=(i + 1)%>"><%=(i + 1)%></a>
				<%}%>
					<a href="groupController.do?thread&ard=<%=ard%>&page=<%=P_pageCount %>" class="last">... <%=P_pageCount %></a> 
				<%}%> 
				<label>
					<input type="text" name="custompage" class="px" size="2" title="输入页码，按回车快速跳转" value="1">
					<span title="共 <%=P_pageCount %>页"> / <%=P_pageCount %>页</span>
				</label> 
				<a href="groupController.do?thread&ard=<%=ard %>&page=<%=(pageNo + 1)%>" class="nxt">下一页</a> 
			</div>
		</div>
	</div>
 
	<div id="f_pst" class="bm" style="width: 960px; margin: 0 auto;border:0px;"> 
		<div class="bm_c" style="overflow: hidden;"> 
				<div class="cl" style="float:left;width:240px;">  
					广告列表
				</div> 
				<div class="cl" style="margin-left: 5px;width:695px;float:right;"> 
						<div class="tedt" style="width:100%;border:0px;margin-bottom: 10px;">
							  <script type="text/plain" id="myEditor" style="width:100%;height:200px;"></script>
						</div>  
					<button onclick="sendArticle()" id="subArticle" style="font-size:12px;font-weight: bold;color:white;background-color: #0090ee;height:30px;line-height: 30px;border:0px;">发表帖子</button>
				</div> 
		</div>
	</div> 
	<div id="dialog-form" style="width:600px;height:200px;"> 
			<span id="div_title">RE: ${article.title}</span>
			<div class="quote">这里我可以写一些输入提示地对地导弹</div>  
			<iframe id="iframeID" frameborder=0 width="100%" height="250" marginheight=0 marginwidth=0 scrolling=no src="groupController.do?groupDemo"></iframe>	
		  
	</div>
	<div style="clear: both"></div> 
</div>

<!--foot -->
<%@include file="foot.jsp"%>

</body>
</html>
<script type="text/javascript">
//实例化编辑器
//var um = UM.getEditor('myEditor2');//全部工具栏
var um = UM.getEditor('myEditor',{ //设置攻击力
    toolbar:  
        ['bold italic underline fullscreen', 'link unlink','| justifyleft justifycenter justifyright justifyjustify |', 'emotion'] 
     
});  
//$("#dialog-form").hide(); 

function sendArticle(){ 
	var text=UM.getEditor('myEditor').getContent(); 
	if(text==null || text==""){
		$.dialog.alert("帖子内容不能为空");
		return;
	}   
	$("#subArticle").css({"enabled":"none"});
	$.ajax({
		async : false,
		cache : false,
		type : 'POST',
		url : 'groupController.do?replayComment',// 请求的action路径
		data : {group_sid:$("#group_sid").val(),gid:$("#group_id").val(),ard:$("#art_id").val(),text:text},
		error : function() {// 请求失败处理函数
			unloading(); 
			$.dialog.alert("提交出错了，请重试！");
		},
		beforeSend: function () {
			loading("提交中...", 1);
		},
		success : function(data) { 
			unloading(); 
			debugger;
			var d = $.parseJSON(data);
			if (d.success) {  
				debugger;
				var user=d.obj.replay_user;
				var article=d.obj.article;
				var html=text;
				$("#post_new").before(html);
				
				$.dialog.alert(d.msg);  
				
			}else{
				$.dialog.alert(d.msg); 
			}
		}
	});
}

function replayWin(aid){ 
	var user_name="span_article_username_"+aid;
	var user_time="span_article_createdate_"+aid;
	var text="div_article_content_"+aid;
	
	var html='<div class="quote"><blockquote>';
		html+='<font size="2"><a href="http://bbs.china95.net/forum.php?mod=redirect&amp;goto=findpost&amp;pid=25665210&amp;ptid=2841592" target="_blank">';
		html+='<font color="#999999" id="win_user_time">'+$("#"+user_name).html()+' 发表于 '+$("#"+user_time).html()+'</font></a></font>';
		html+='<br>'+$("#"+text).html();
		html+='</blockquote></div>';
		
	$(".quote").html(html);
	  
	$( "#dialog-form" ).dialog({
	    autoOpen: true,
	    title:"回复",
	    //height: auto,
	    width: 625,
	    modal: true,
	    buttons: {
	      "确定": function() { 
			debugger;
			var text=$("#iframeID")[0].contentWindow.getReplayContext();  
			if(text==null || text==""){
				$.dialog.alert("帖子内容不能为空");
				return;
			}    
			text=html+text;
			$.ajax({
				async : false,
				cache : false,
				type : 'POST',
				url : 'groupController.do?replayComment',// 请求的action路径
				data : {group_sid:$("#group_sid").val(),gid:$("#group_id").val(),ard:$("#art_id").val(),text:text},
				error : function() {// 请求失败处理函数
					unloading(); 
					$.dialog.alert("提交出错了，请重试！");
				},
				beforeSend: function () {
					loading("提交中...", 1);
				},
				success : function(data) { 
					unloading();  
					var d = $.parseJSON(data);
					if (d.success) {  
						debugger;
						var user=d.obj.replay_user;
						var article=d.obj.article;
						appendHtml(user,article); 
				        $(this).dialog( "close" );
					}else{
						$.dialog.alert(d.msg); 
					}
				}
			});
	      },
	      "取消": function() {
	        $( this ).dialog( "close" );
	      }
	    },
	    close: function() {
	     // allFields.val( "" ).removeClass( "ui-state-error" );
	    }
	  });
	  
	
	//$("#dialog-form").dialog("open");
}

function appendHtml(user,article){
	var html=text;
	
	$("#post_new").before(html); 
}

function replayPfWin(aid){
	$.dialog.alert(aid);
}
</script>